package cn.js.sip.rat.system.entity;

//import cn.js.sip.rat.common.enums.SysEnum;
import cn.js.sip.rat.system.util.ShiroUtils;
import com.baomidou.mybatisplus.annotation.TableId;

import java.io.Serializable;
import java.util.Date;
import java.util.UUID;

/**
 * @ClassName: cn.js.sip.rat.common.entity
 * @Description: TODO 基本实体类每一个实体都应该直接或者间接继承BaseEntity
 * @author: xuxiaoli
 * @Date: 2019-12-27   18:49
 */
public class BaseEntity implements Serializable {
    /***主键*/
    @TableId("PID")
    private String id;
    /***备注*/
    private String remark;
    /***创建者Id*/
    private String createrId;
    /***创建者*/
    private String creater;
    /***创建时间*/
    private Date createrTime;
    /***最后修改人id*/
    private String lastModifierId;
    /***最后修改人*/
    private String lastModifier;
    /***最后修改时间*/
    private Date lastModifierTime;
    /***删除标记*/
    private Integer deleteFlag;

    /**
     * 设置创建信息
     */
    public void setCreateInfo() {
        setId(UUID.randomUUID().toString());
        setCreateInfoNoId();

    }

    /**
     * 设置修改信息
     */
    public void setLastModifyInfo() {
        setLastModifierTime(new Date());
        setLastModifierId("");
    }

    /**
     * 设置创建信息（不需要设置ID）
     */
    public void setCreateInfoNoId() {
        setCreaterId(ShiroUtils.getSysUser().getId());
        setCreaterId(ShiroUtils.getSysUser().getName());
        setCreaterTime(new Date());
        setDeleteFlag(0);
    }

    public Boolean isAdmin() {
        return this.id.equals("-1");
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getCreaterId() {
        return createrId;
    }

    public void setCreaterId(String createrId) {
        this.createrId = createrId;
    }

    public String getCreater() {
        return creater;
    }

    public void setCreater(String creater) {
        this.creater = creater;
    }

    public Date getCreaterTime() {
        return createrTime;
    }

    public void setCreaterTime(Date createrTime) {
        this.createrTime = createrTime;
    }

    public String getLastModifierId() {
        return lastModifierId;
    }

    public void setLastModifierId(String lastModifierId) {
        this.lastModifierId = lastModifierId;
    }

    public String getLastModifier() {
        return lastModifier;
    }

    public void setLastModifier(String lastModifier) {
        this.lastModifier = lastModifier;
    }

    public Date getLastModifierTime() {
        return lastModifierTime;
    }

    public void setLastModifierTime(Date lastModifierTime) {
        this.lastModifierTime = lastModifierTime;
    }

    public Integer getDeleteFlag() {
        return deleteFlag;
    }

    public void setDeleteFlag(Integer deleteFlag) {
        this.deleteFlag = deleteFlag;
    }
}
